<div id="page-title" class="clearfix">		
	<ul class="breadcrumb">
		<li>
			<?php echo CHtml::link('Home',array('/site/index')); ?><span class="divider">/</span>
		</li>
		<li>
			<?php echo CHtml::link('Type (Film)',array('/type/admin')); ?><span class="divider">/</span>
		</li>
		<li class="active">List Type</li>
	</ul>		
</div> <!-- /.page-title -->

<?php

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('type-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div id="horizontal" class="widget widget-form">
	<div class="widget-header">	      				
		<h3>
		     <i class="icon-search"></i>
		     <?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>      					
		</h3>	
	</div> <!-- /widget-header -->
	<div class="widget-content search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
	</div><!-- search-form -->
</div>
<div class="widget widget-table">
	<div class="widget-header">						
	<h3>
		<i class="icon-th-list"></i>
		Manage Film Type						
	</h3>
</div> <!-- /widget-header -->
		<div class="widget-content">
<?php $form=$this->beginWidget('CActiveForm', array(
    'enableAjaxValidation'=>true,
)); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'type-grid',
	'dataProvider'=>$model->search(),
	'summaryText'=>'',
	'htmlOptions'=>array('class'=>'table table-striped table-bordered responsive'),
	'pagerCssClass'=>'pagination pagination-centered',
	'columns'=>array(
		array(
            'id'=>'autoId',
            'class'=>'CCheckBoxColumn',
            'selectableRows' => '50',   
        ),
		'id',
		array(
            'name'=>'Name',
            'value'=>'$data->name',
			'htmlOptions'=>array("width"=>"44%"),
        ),
        array(
            'name'=>'Icon',
            'type'=>'raw',
            'value'=>'CHtml::image($data->icon,$data->icon,array("style"=>"max-width:60px;"))',
            'htmlOptions'=>array("width"=>"65px"),
        ),
        
		array(
            'name'=>'order',
            'type'=>'raw',
            'value'=>'CHtml::textField("order[$data->id]",$data->order,array("style"=>"width:65px;"))',
            'htmlOptions'=>array("width"=>"65px"),
        ),
        array(
            'name'=>'Hot',
            'header'=>'Hot',
            'value'=>'($data->hot=="1")?("Yes"):("No")',
        	'htmlOptions'=>array("width"=>"35px"),
        ),
		array(
            'name'=>'active',
            'header'=>'Active',
            'value'=>'($data->active=="1")?("Yes"):("No")'
        ),
		array(
			'header'=>'Action',
			'class'=>'CButtonColumn',
			'buttons'=>array(
		        'delete' => array
		        (
		            'label'=>'Delete',
		        	'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/delete-file-icon_24.png',
		        	'url'=>'Yii::app()->createUrl("type/delete", array("id"=>$data->id))',
		        ),
		        'update' => array
		        (
		            'label'=>'Update',
		        	'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/table-edit-icon_24.png',
		            'url'=>'Yii::app()->createUrl("type/update", array("id"=>$data->id))',
		        ),
		        'view' => array
		        (
		            'label'=>'View',
		        	'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/folder-movies-icon_24.png',
		            'url'=>'Yii::app()->createUrl("type/view", array("id"=>$data->id))',
		        	'visible'=>'false'
		        ),
        	),
			'htmlOptions'=>array("width"=>"80px"),
		),
	),
)); ?>
<script>
function reloadGrid(data) {
    $.fn.yiiGridView.update('type-grid');
}
</script>
<div style="padding-top: 10px;border-top: 1px solid #cccccc;padding-left: 20px;">
<?php echo CHtml::ajaxSubmitButton('Filter',array('type/ajaxupdate'), array(),array("style"=>"display:none;")); ?>
<?php echo CHtml::ajaxSubmitButton('Activate',array('type/ajaxupdate','act'=>'doActive'), array('success'=>'reloadGrid'),array('class'=>'btn btn-success','style'=>'margin-right:20px;')); ?>
<?php echo CHtml::ajaxSubmitButton('In Activate',array('type/ajaxupdate','act'=>'doInactive'), array('success'=>'reloadGrid'),array('class'=>'btn btn-warning','style'=>'margin-right:20px;')); ?>
<?php echo CHtml::ajaxSubmitButton('Active Hot',array('type/ajaxupdate','act'=>'doHot'), array('success'=>'reloadGrid'),array('class'=>'btn btn-success','style'=>'margin-right:20px;')); ?>
<?php echo CHtml::ajaxSubmitButton('Inactive Hot',array('type/ajaxupdate','act'=>'doUnhot'), array('success'=>'reloadGrid'),array('class'=>'btn btn-warning','style'=>'margin-right:20px;')); ?>
<?php echo CHtml::ajaxSubmitButton('Delete',array('type/ajaxupdate','act'=>'doDelete'), array('success'=>'reloadGrid'),array('class'=>'btn btn-danger','style'=>'margin-right:20px;')); ?>
<?php echo CHtml::ajaxSubmitButton('Update sort order',array('type/ajaxupdate','act'=>'doSortOrder'), array('success'=>'reloadGrid'),array('class'=>'btn btn-inverse','style'=>'margin-right:20px;')); ?>
</div>
	<?php $this->endWidget(); ?>
</div> <!-- /widget-content -->
</div> <!-- /widget -->